![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
base64-stream
Advanced tools
Contains new Node.js v0.10 style stream classes for encoding / decoding Base64 data
The base64-stream npm package provides a streaming interface for encoding and decoding data in base64 format. It is particularly useful for handling large amounts of data that need to be processed in chunks, such as files or network streams.
Base64 Encoding
This feature allows you to encode a stream of data into base64 format. In this example, the contents of 'input.txt' are read, encoded in base64, and then written to 'output.txt'.
const fs = require('fs');
const base64 = require('base64-stream');
fs.createReadStream('input.txt')
.pipe(base64.encode())
.pipe(fs.createWriteStream('output.txt'));
Base64 Decoding
This feature allows you to decode a base64-encoded stream of data. In this example, the contents of 'input.txt' are read, decoded from base64, and then written to 'output.txt'.
const fs = require('fs');
const base64 = require('base64-stream');
fs.createReadStream('input.txt')
.pipe(base64.decode())
.pipe(fs.createWriteStream('output.txt'));
The base64-js package provides utilities for encoding and decoding base64 strings. Unlike base64-stream, it does not offer a streaming interface and is more suited for smaller data sizes that can be handled in memory.
The base64url package is designed for encoding and decoding base64 URL-safe strings. It is useful for web applications where URL-safe encoding is required. However, it does not provide a streaming interface like base64-stream.
The node-base64-image package allows you to encode and decode images to and from base64 strings. It is specialized for image data and does not offer a general-purpose streaming interface like base64-stream.
While Node.js has built-in support for Base64 data, it does not come with the ability to encode / decode data in a stream.
This library contains a streaming Base64 encoder and a streaming Base64 decoder for use with Node.js. These classes are written using the new Node.js v0.10 stream interfaces and are well covered with unit tests.
To install base64-stream
npm install base64-stream
This example encodes an image and pipes it to stdout.
var http = require('http');
var base64 = require('base64-stream');
var img = 'http://farm3.staticflickr.com/2433/3973241798_86ddfa642b_o.jpg';
http.get(img, function(res) {
if (res.statusCode === 200)
res.pipe(base64.encode()).pipe(process.stdout);
});
This example takes in Base64 encoded data on stdin, decodes it, an pipes it to stdout.
var base64 = require('base64-stream');
process.stdin.pipe(base64.decode()).pipe(process.stdout);
You may also treat encode
/ decode
as classes, so the following is also valid:
var Base64Decode = require('base64-stream').decode;
var stream = new Base64Decode();
...
This module currently requires Node v0.8 or higher. Support for versions prior to v0.10 is made possible by using the readable-stream module.
To run the unit tests
npm test
MIT
FAQs
Contains new Node.js v0.10 style stream classes for encoding / decoding Base64 data
The npm package base64-stream receives a total of 325,718 weekly downloads. As such, base64-stream popularity was classified as popular.
We found that base64-stream demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.